def getrownum(c, table_name):
    table_name = 'pidata'
    
    sql = 'select count(*) from %s' % table_name

    c.execute(sql)  
    r = c.fetchone()
    return r[0]